<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body class="timo-layout-page">
    <div class="layui-card">
        <div class="layui-card-header timo-card-header">
            <span><i class="fa fa-bars"></i> 邮箱系统管理</span>
            <i class="layui-icon layui-icon-refresh refresh-btn"></i>
        </div>
        <div class="layui-card-body">
            <div class="layui-row timo-card-screen">
                <div class="pull-left layui-form-pane timo-search-box">
                    <div class="layui-inline">
                        <label class="layui-form-label">状态</label>
                        <div class="layui-input-block timo-search-status">
                            <select class="timo-search-select" name="status" mo:dict="SEARCH_STATUS" mo-selected="${param.status}"></select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">邮件ID</label>
                        <div class="layui-input-block">
                            <input type="text" name="messageNumber" th:value="${param.messageNumber}" placeholder="请输入邮件ID" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">主题</label>
                        <div class="layui-input-block">
                            <input type="text" name="subject" th:value="${param.subject}" placeholder="请输入主题" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">发件人</label>
                        <div class="layui-input-block">
                            <input type="text" name="fromAddress" th:value="${param.fromAddress}" placeholder="请输入发件人" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">收件人</label>
                        <div class="layui-input-block">
                            <input type="text" name="receiveAddress" th:value="${param.receiveAddress}" placeholder="请输入收件人" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn timo-search-btn">
                            <i class="fa fa-search"></i>
                        </button>
                    </div>
                </div>
                <div class="pull-right screen-btn-group">
                    <button class="layui-btn open-popup" data-title="添加邮箱系统" th:attr="data-url=@{/system/mail/add}" data-size="auto">
                        <i class="layui-icon layui-icon-edit"></i> 写邮件</button>
                    <button class="layui-btn"  id="getMail">
                        <i class="fa fa-plus"></i> 收取</button>
                </div>
            </div>
            <div class="timo-table-wrap">
                <table class="layui-table timo-table">
                    <thead>
                    <tr>
                        <th class="timo-table-checkbox">
                            <label class="timo-checkbox"><input type="checkbox">
                                <i class="layui-icon layui-icon-ok"></i></label>
                        </th>
                        <th>主键ID</th>
                        <th>邮件ID</th>
                        <th>主题</th>
                        <th>发件人</th>
                        <th>收件人</th>
                        <th>发送时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <tr th:each="item:${list}" th:style="'color:' + @{(${item.isSeen} ? '#ccc' : '')} + ''" >
                        <td><label class="timo-checkbox"><input type="checkbox" th:value="${item.id}">
                            <i class="layui-icon layui-icon-ok"></i></label></td>
                        <td th:text="${item.id}">主键ID</td>
                        <td th:text="${item.messageNumber}">邮件ID</td>
                        <td> <a class="open-popup" data-title="查看" th:style="'color:' + @{(${item.isSeen} ? '#ccc' : '')} + ''" th:attr="data-url=@{'/system/mail/detail/'+${item.id}}" data-size="800,600" href="#" th:text="${item.subject}">主题</a></td>
                        <td th:text="${item.fromAddress}">发件人</td>
                        <td th:text="${item.receiveAddress}">收件人</td>
                        <td th:text="${item.sentDate}">发送时间</td>
                        <td th:text="${#dicts.dataStatus(item.status)}">数据状态</td>
                        <td>
                            <a class="open-popup" data-title="查看" th:attr="data-url=@{'/system/mail/detail/'+${item.id}}" data-size="800,600" href="#">查看</a>
                            <a class="ajax-get" data-msg="您是否确认删除" th:href="@{/system/mail/status/delete(ids=${item.id})}">删除</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div th:replace="/common/fragment :: page"></div>
        </div>
    </div>
<script th:replace="/common/template :: script"></script>
<script>


    layui.use(['laydate','carousel','element'], function() {
        var laydate = layui.laydate;
        var $ = layui.$;
        var element = layui.element;

       $("#getMail").click(function () {
           $.get("/system/mail/getMail",function (data) {
               layer.msg("收取成功");
               location.reload();
           })

       })

    });

</script>
</body>
</html>